home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
public
/
ghostview
/
gs.interface
< prev
next >
Wrap
Text File
|
1994-08-01
|
4KB
|
109 lines
Ghostview interface to ghostscript
When the GHOSTVIEW environment variable is set, ghostscript draws on
an existing drawable rather than creating its own window. Ghostscript
can be directed to draw on either a window or a pixmap.
Drawing on a Window
The GHOSTVIEW environment variable contains the window id of the target
window. The window id is an integer. Ghostview will use the attributes
of the window to obtain the width, height, colormap, screen, and visual of
the window. The remainder of the information is gotten from the GHOSTVIEW
property on that window.
Drawing on a Pixmap
The GHOSTVIEW environment variable contains a window id and a pixmap id.
They are integers separated by white space. Ghostview will use the attributes
of the window to obtain the colormap, screen, and visual to use. The
remainder of the information, including the width and height of the pixmap,
is gotten from the GHOSTVIEW property on the window. In this case, the
property is deleted when read.
The GHOSTVIEW environment variable
parameters: window-id [pixmap-id]
scanf format: "%d %d"
explanation of parameters:
window-id: tells ghostscript where to
- read the GHOSTVIEW property
- send events
If pixmap-id is not present,
ghostscript will draw on this window.
pixmap-id: If present, tells ghostscript that a pixmap will be used
as the final destination for drawing. The window will
not be touched for drawing purposes.
The GHOSTVIEW property
type: STRING
parameters:
Drawing on a window:
bpixmap orient llx lly urx ury xdpi ydpi [left bottom top right]
Drawing on a pixmap:
bpixmap orient llx lly urx ury xdpi ydpi left bottom top right width height
scanf format: "%d %d %d %d %d %d %f %f %d %d %d %d %d %d"
explanation of parameters:
bpixmap: pixmap id of the backing pixmap for the window. If no
pixmap is to be used, this parameter should be zero. This
parameter must be zero when drawing on a pixmap.
orient: orientation of the page. The number represents clockwise
rotation of the paper in degrees. Permitted values are
0, 90, 180, 270.
llx, lly, urx, ury: Bounding box of the drawable. The bounding box
is specified in PostScript points in default user coordinates.
xdpi, ydpi: Resolution of window. (This can be derived from the
other parameters, but not without roundoff error. These
values are included to avoid this error.)
left, bottom, top, right: (optional when drawing on a window)
Margins around the window. The margins extend the imageable
area beyond the boundaries of the window. This is primarily
used for popup zoom windows. I have encountered several
instances of PostScript program that position themselves
with respect to the imageable area. The margins are specified
in PostScript points. If omitted, the margins are assumed to
be 0.
width, height: (Only specified when drawing on Pixmap)
The width and height of the pixmap. (Too bad that we can't
just query the server.)
Events from ghostscript
If the final destination is a pixmap, the client will get a property notify
event when ghostscript reads the GHOSTVIEW property causing it to be deleted.
Ghostscript sends events to the window where it read the GHOSTVIEW property.
These events are of type ClientMessage. The message_type is set to
either PAGE or DONE. The first long data value gives the window to be used
to send replies to ghostscript. The second long data value gives the primary
drawable. If rendering to a pixmap, it is the primary drawable. If rendering
to a window, the backing pixmap is the primary drawable. If no backing pixmap
is employed, then the window is the primary drawable. This field is necessary
to distinguish multiple ghostscripts rendering to separate pixmaps where the
GHOSTVIEW property was placed on the same window.
The PAGE message indicates that a "page" has completed. Ghostscript will
wait until it receives a ClientMessage whose message_type is NEXT before
continuing.
The DONE message indicates that ghostscript has finished processing.